Skip to content

Add PTF tests for Tutorial Exercise # 2#733

Open
aqn96 wants to merge 4 commits intop4lang:masterfrom
aqn96:feat/ptf-tests-basic-tunnel
Open

Add PTF tests for Tutorial Exercise # 2#733
aqn96 wants to merge 4 commits intop4lang:masterfrom
aqn96:feat/ptf-tests-basic-tunnel

Conversation

@aqn96
Copy link
Contributor

@aqn96 aqn96 commented Mar 22, 2026

Addresses part of #103 issue (exercise 2 tests)
Adds automated PTF tests for the basic_tunnel exercise that run against solution/basic_tunnel.p4.
Included:
ptf/basic_tunnel.py — Seven tests

  • Ipv4DropOnMissTest — verifies plain IPv4 packets are dropped with no LPM table entries

  • Ipv4ForwardTest — verifies IPv4 forwarding with correct MAC rewrite and TTL decrement

  • TunnelForwardTest — verifies tunneled packets are forwarded correctly by dst_id

  • TunnelDropOnMissTest — verifies tunneled packets are dropped with no tunnel table entry

  • MixedTrafficTest — verifies IPv4 and tunnel traffic are handled independently

  • TunnelUnknownProtoTest — verifies tunnel forwarding is based solely on dst_id regardless of proto_id

  • TtlBoundaryTest — verifies TTL decrements correctly at boundary value

  • runptf.sh — compiles solution, starts simple_switch_grpc, runs PTF tests, cleans up

  • Makefile — adds make test target

  • .gitignore — excludes build artifacts and log files

  • test-exercises.yml — refactored CI to use matrix strategy, added concurrency and timeout. Used this as an example: https://github.com/p4lang/p4-dpdk-target/blob/main/.github/workflows/build_p4sde_ci.yml

Cleanup:

  • Removed mention of make test from exercises/basic/README.md as per @jafingerhut suggestion that tests are intended for maintainers/contributors only, not students

Test Result:
image

aqn96 added 4 commits March 22, 2026 13:49
Signed-off-by: An <aqnguyen96@gmail.com>
Signed-off-by: An <aqnguyen96@gmail.com>
…fix comments/docs

Signed-off-by: An <aqnguyen96@gmail.com>
@aqn96 aqn96 force-pushed the feat/ptf-tests-basic-tunnel branch from df88920 to b0b455b Compare March 22, 2026 20:49
@aqn96 aqn96 marked this pull request as ready for review March 22, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant